package com.dormitory.javadormitory.mapper;

import com.dormitory.javadormitory.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface UserAvatarMapper {

    @Select("select * from student where sex='女'")
    ArrayList<Student> arr();

    @Insert("insert into student (name,classs,enrollmentTime,bunkhouseName,sex) " +
            "values (#{student.name},#{student.classs},#{student.enrollmentTime},#{student.bunkhouseName},#{student.sex})")
    void insertVerify(@Param("student") Student student);

    @Select("select * from student where id = #{id}")
    Student updateById(int id);

    @Update("update student set name = #{student.name},classs = #{student.classs}," +
            "enrollmentTime = #{student.enrollmentTime},bunkhouseName = #{student.bunkhouseName} where id = #{student.id}")
    void updateStudent(@Param("student") Student student);

    @Delete("delete from student where id = #{id}")
    void studentDeleteD(int id);

    @Select("select * from student where name like concat('%',#{name},'%')")
    ArrayList<Student> onSubmitName(String name);

    @Select("select * from student where bunkhouseName=#{bunkhouseName}")
    ArrayList<Student> onSubmitBunkhouseName(String bunkhouseName);

}
